<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script type="text/javascript">
    // ES5 传统模式

    // var a = 10;
    // b = 20;
    // console.log(a, b);

    // function fn() {
    //     console.log(this);
    // }
    // fn(); // this -> window

    /* function wrap() {
        function fn() {
            console.log(this);
        }
        fn(); // this默认指向window
    }

    wrap(); */

    // function sum(a, b, b) {
    //     console.log(a, b);
    //     return a + b;
    // }

    // // sum(1, 2); //3
    // var result = sum(1, 2, 3);
    // console.log(result);


    // eval()  接收一个字符串,将字符串作为js语句解析

    // var str = "alert(1111)";
    // eval(str); // alert(1111)

    // eval("debugger;var x = 1;var y = 2;var z = x + y;");
    // console.log(x, y, z);


    // delete    删除对象的属性
    var obj = { a: 1, b: 2, c: 3, d: 4 };

    console.log(delete obj.a);
    console.log(delete obj.b);
    console.log(delete obj.c);
    console.log(delete obj.d);

    console.log(obj);

    var obj = new String("hello");

    console.log(delete obj[0]);
    console.log(delete obj[1]);
    console.log(delete obj[2]);
    console.log(delete obj[3]);
    console.log(delete obj[4]);
    console.log(obj);





</script>

</html>